import  * as VueRouter  from "vue-router";
import { close, start } from '../components/nprogress/nprogress.ts';

const routes:any = [
    // {path: '/admin/login',name:'adminLogin',component: () => import('../views/login.vue'),children:[]},
    { path: '/',name:'index',meta:{name:'首页'},component: () => import('../views/index.vue')},
    { path: '/type',name:'type',meta:{name:'课程类型'},component: () => import('../views/course/index.vue')},
    { path: '/course',name:'course',meta:{name:'课程学习'},component: () => import('../views/course/index.vue')},
    { path: '/course/show/:id',name:'courseShow',meta:{name:'课程学习详情'},component: () => import('../views/course/show.vue')},
    { path: '/course/video/:id/:video_id?',name:'courseVideo',meta:{name:'课程学习详情'},component: () => import('../views/course/video.vue')},
    { path: '/product',name:'product',meta:{name:'材料推荐'},component: () => import('../views/product/index.vue')},
    { path: '/product/show/:id',name:'productShow',meta:{name:'材料推荐'},component: () => import('../views/product/show.vue')},
    { path: '/hire',name:'hire',meta:{name:'人才招聘'},component: () => import('../views/hire/index.vue')},
    { path: '/posts',name:'posts',meta:{name:'新闻资讯'},component: () => import('../views/posts/index.vue')},
    { path: '/posts/show/:id',meta:{name:'新闻资讯详情'},name:'postsShow',component: () => import('../views/posts/show.vue')},
    { path: '/live',name:'live',meta:{name:'直播课程'},component: () => import('../views/live/index.vue')},
    { path: '/information',name:'information',meta:{name:'资料下载'},component: () => import('../views/information/index.vue')},
    { path: '/information/show/:id',meta:{name:'资料下载详情'},name:'informationShow',component: () => import('../views/information/show.vue')},
    { path: '/node',name:'node',meta:{name:'工艺节点'},component: () => import('../views/node/index.vue')},
    { path: '/node/show/:id',name:'nodeShow',meta:{name:'工艺节点详情'},component: () => import('../views/node/show.vue')},
    { path: '/user',name:'user',meta:{name:'会员中心'},component: () => import('../views/user/index.vue')},
    { path: '/user/pay/:type/:id',name:'userPay',meta:{name:'会员支付'},component: () => import('../views/pay/pay.vue')},
    { path: '/user/login',name:'login',meta:{name:'登录'},component: () => import('../views/login/login.vue')},
    { path: '/user/register',name:'register',meta:{name:'注册'},component: () => import('../views/login/register.vue')},

]
  
const router = VueRouter.createRouter({
    scrollBehavior:() => ({ left:0,top:0 }),
    history: VueRouter.createWebHashHistory(),
    routes,
})

router.beforeEach(() => {
	start();
})
 
router.afterEach(() => {
	close();
})

export default router